home *** CD-ROM | disk | FTP | other *** search
- /* ======================================== */
- /* FINAL WRITER AREXX MACRO */
- /* by Nigel S. Domaingue, 28/1/95 */
- /* */
- /* Script to remove undesired Sections. */
- /* $Ver: Remove_Section 1.0 (28/1/95) */
- /* ======================================== */
-
- /* Allows user to move to remove any Main section. */
- /* Only use if there are less than 6 sections. */
-
- Options Results
-
- GetSectionList ","
- listing = Result
-
- /* Set up a stem (i.e. array) */
- x. = Section
- y. = '""'
-
- /* Split 'listing' into component parts */
- /* and put those into the x. stem. */
- PARSE VAR listing x.1 ',' x.2 ',' x.3 ',' x.4 ',' x.5 ',' x.6 ',' x.7 ',' x.8 ',' x.9 ',' x.10
- do i = 1 to 10
- IF ( LENGTH(x.i) = 0 ) THEN
- Do
- n = i-1
- i = 10
- end
- end
-
- /* If the document only has one section */
- /* there are three options: */
- /* 1) Close that document only */
- /* 2) Quit the whole program */
- /* 3) Do nothing (Exit the script) */
-
- If ( n = 1 ) THEN
- ShowMessage 3 1 '"This document only has one section" "Quit the document?" "" "Close Document" "Quit FW" "Cancel"'
- If ( Result = 1 ) Then Close
- If ( Result = 2 ) Then Quit
- If ( Result = 3 ) Then Exit
-
- /* This section of the script is labelled so that it can */
- /* be returned to later if required. */
-
- getinput:
- m=0
- RequestText '"Choose section to remove." "Pattern to match: (Case insensitive)" ""'
- choice = Upper(Result)
- len = Length(choice)
- Do i = 1 to n
- /* If pattern matches part of an available section */
- /* 'first' will return the position of the first */
- /* character in the matched sequence. (non zero) */
- /* If there is more than one match (i.e. a vague */
- /* pattern), the script will detect this. */
-
- first = index(Upper(x.i),choice)
- if (first~=0) Then
- Do
- m=m+1
- y.m = '"'x.i'"'
- end
- end
-
-
- If ( m = 0 ) Then
- Do
- firstline = '"Section 'choice' not found."'
- ShowMessage 1 0 firstline '"(You might have mis-spelled it)." "" "Try Again " "Cancel" ""'
- If ( Result = 1 ) Then Signal 'getinput'
- Else NOP
- Exit
- end
-
- If ( m = 1 ) Then
- Do
- RemoveSection y.1
- Exit
- End
-
- If ( m <= 3 ) Then
- Do
- firstline = '"'m' Sections match your pattern."'
- ShowMessage 1 0 firstline '"Which one to remove?" ""' y.1 y.2 y.3
- del = Result
- RemoveSection y.del
- Exit
- End
-
- If ( m <= 5 ) Then
- Do
- firstline = '"'m' Sections match your pattern."'
- ShowMessage 3 0 firstline '"Which one to remove?" ""' y.1 y.2 '"Next List "'
- del = Result
- If ( del = 3 ) Then
- Do
- ShowMessage 1 0 '"Which One to remove?" "" ""' y.3 y.4 y.5
- del = Result + 2
- End
- Else NOP
- RemoveSection y.del
- Exit
- End
-
- If ( m > 5 ) Then
- Do
- ShowMessage 1 0 '"There are more than 5 matches to your pattern." "Either use a more reliable pattern, or" "use the menus." "Silly me" "" ""'
- Exit
- End
-
-
-
-
-